#!/bin/bash
if [ $1 == "fs" ]
then
   
	echo "*******************************"
	echo "front stop"
	echo "*******************************"
	kill -9 $(ps aux|grep jetty | grep -v grep | awk '{print $2}')

elif [ $1 == "fr" ]
then

	echo "*******************************"
	echo "front restart"
	echo "*******************************"
	kill -9 $(ps aux|grep jetty | grep -v grep | awk '{print $2}')
	java -Djetty.port=80 -Dfile.encoding=UTF-8 -Djetty.logs=/opt/logs -Djetty.home=/opt/jetty -Djetty.base=/opt/jetty -Djava.io.tmpdir=/tmp -jar /opt/jetty/start.jar jetty.state=/opt/jetty/jetty.state jetty-started.xml &

elif [ $1 == "sr" ]
then

	echo "*******************************"
 	echo "server restart"
  	echo "*******************************"
	kill -9 $(ps -aux|grep java|awk '{print $2}')
	VM_PARAM='-server -Xmx1G -Xms1G -XX:SurvivorRatio=8 -XX:NewRatio=4 -XX:PermSize=128m -XX:MaxPermSize=256m -XX:+DisableExplicitGC -XX:+PrintGCDetails -XX:+PrintGCTimeStamps -XX:+PrintCommandLineFlags -XX:+UseConcMarkSweepGC -XX:+UseParNewGC -XX:ParallelCMSThreads=4 -XX:+CMSClassUnloadingEnabled -XX:+UseCMSCompactAtFullCollection -XX:CMSFullGCsBeforeCompaction=1 -XX:CMSInitiatingOccupancyFraction=65'
	java -Dfile.encoding=UTF-8 ${VM_PARAM} -jar /opt/target/cloud-device-server.jar &

elif [ $1 == "ss" ]
then

	echo "*******************************"
 	echo "server restart"
	echo "*******************************"
	kill -9 $(ps -aux|grep java|awk '{print $2}')

fi

-server
-Xmx1G
-Xms1G
-XX:SurvivorRatio=8
-XX:NewRatio=4
-XX:PermSize=128m
-XX:MaxPermSize=256m
-XX:+DisableExplicitGC
-XX:+PrintGCDetails
-XX:+PrintGCTimeStamps
-XX:+PrintCommandLineFlags
-XX:+UseConcMarkSweepGC 默认新生代parnew收集器
-XX:+UseParNewGC 默认新生代parnew收集器 多CPU使用才有效果
-XX:ParallelCMSThreads=4 限制垃圾收集器线程数 CMS并发收集器交替CPU收集
-XX:+CMSClassUnloadingEnabled
-XX:+UseCMSCompactAtFullCollection
-XX:CMSFullGCsBeforeCompaction=1
-XX:CMSInitiatingOccupancyFraction=65
